<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统设置</title>
    <link rel="stylesheet" href="/model/css/bootstrap.min.css"/>
    <style>
        div.checkbox *{
            vertical-align: bottom !important;
        }
    </style>
</head>
<body>
<form>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <div class="checkbox">
                <label><input type="checkbox" id="autoSaveCk" onchange="autoSave(this)">是否自动保存</label>
            </div>
        </div>
    </div>
</form>
</body>
<script src="/model/js/jquery.min.js"></script>
<script>
    //监测
    function autoSave(obj){
        let attr = obj.checked;
        //发送相关的数据进行设置
        $.ajax({
            url:'/system/setSystemSetting',
            data:JSON.stringify({"isAutoSave":attr}),
            type:'post',
            dataType:'json',
            headers:{
                Accept:"application/json",
                "Content-Type":"application/json"
            },
            processData:false,
            cache:false
        }).done(function (data) {

        });
    }

    $(function () {

        $.get("/system/getSystemSetting", function(data){
            if (data.code == "200"){
                data = data.data;
                $("#autoSaveCk").prop("checked",data.isAutoSave);
            }

        });

    });

</script>
</html>